package kr.yoon.practice.db.common;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Properties;

import javax.swing.DebugGraphics;

import kr.yoon.practice.db.dao.DaoInterface;
import kr.yoon.practice.db.dao.DepartmentDAO;
import kr.yoon.practice.db.dto.Department;

public class TestMain {
	public static void main(String[] args) throws SQLException{
		Connection con = ConnectionFactory.getConnection();
		String filePath = "dbcon.xml";
		String driver = "com.mysql.jdbc.Driver";
		String url = "jdbc:mysql://localhost:3306/erp";
		String user = "root";
		String password = "1111";
		
/*		DBProperties.saveProperties("dbcon.xml", driver,url,user,password);
		System.out.println(prop.getProperty("DRIVER"));
		System.out.println(prop.getProperty("URL"));
		System.out.println(prop.getProperty("USER"));
		System.out.println(prop.getProperty("PASSWORD")); //대문자로 해야됨..
		DBProperties.prnProperties(DBProperties.loadProperties(filePath)); */
		
		Properties prop  = DBProperties.loadProperties("dbcon.xml");
		DBProperties.prnProperties(prop);
	
/*		DaoInterface<Department> dao = new DepartmentDAO(con);
		Department dept = new Department();
		
		ArrayList<Department> lists = dao.listItems();
		
		
		dao.insertItem(new Department(11, "마케팅", 9));
		for(Department d : lists){
			System.out.println(d);
		}*/
		
		DBUtil.close(con);
	}
}
